package com.ruix.app.mapper;

import com.ruix.app.model.User;

import org.json.JSONObject;

/**
 * Created by hadexs on 2017/5/5.
 */

public class UserMapper implements ApiMapper<User>{


    @Override
    public User transform(JSONObject response) {
        JSONObject data =  response.optJSONObject("data");
        if (data != null){
          JSONObject userObject =   data.optJSONObject("user");
            if (userObject != null){
                User user = new User().parse(userObject);
                return user;
            }

        }

        return null;
    }
}
